 <%@page import="java.sql.*,java.io.*,java.util.*" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<head>



<jsp:include page="Header.jsp"></jsp:include>
<script type="text/javascript">

 
 
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()

var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"

if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12

if (minutes<=9)
minutes="0"+minutes

if (seconds<=9)
seconds="0"+seconds

var cdate="<small> <font color='purple' face='Arial'> <b>"+hours+":"+minutes+":"+seconds+"</b> </font> </small> "

document.write("<h3><font color='purple'>Exam Started Time :</h3></font>");
document.write(cdate)

document.write("<h3><font color='00ffff'> Current Time :</h3></font>");
</script>
<script type="text/javascript">
var win=null;
function opWin() {
if(win==null || win.closed) {
win=window.open("", "newwin", "width=200, height=200");
win.document.write("<html><head><title>Confirm Dialog</title><\/head>");
win.document.write("<h3><font color='red'>Are You Sure You Want To Cancel Your Exam</h3></font>");
win.document.write("<input type='button' value='Yes' onclick='window.close();opener.location=\"StudentExamAction.jsp\";'><\/input>");
win.document.write("<input type='button' value=' No ' onclick='window.close();opener.location=\"StudentExam.jsp\";'><\/input><\/body><\/html>");
}
win.focus();
}
 
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate()
{
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"

if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes

if (seconds<=9)
seconds="0"+seconds
var cdate="<small> <font color='00ffff' face='Arial'> <b> "+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b> </font> </small> "

if (document.all){
document.all.clock.innerHTML=cdate

}

else if (document.getElementById)
{
document.getElementById("clock").innerHTML=cdate

}
else
{
 
document.write(cdate)

}


 
}

if (!document.all&&!document.getElementById)
getthedate()
function goforit()
{

if (document.all||document.getElementById)
{

setInterval("getthedate()",1000)
}

//set the Time

var i=document.getElementById("Time").value;
setTimeout('document.myform.submit()',i*(60*1000));
return i;
}


function loadNextPage() 
{
    window.location.href = './jsps/StudentExamAction.jsp';
      
}

//set your exam time here 




</script>
<span id="clock"></span>


<body bgcolor="" onLoad="goforit()" >


<center><font color="#4D88DB"><h2>Question Paper</h2></font></center>

<form action="./jsps/StudentExamAction.jsp" name="myform">
   
    <table align="center" border="1">
        <tr><th><font color="#4D88DB">Question no</font></th>
        <th><font color="#4D88DB">Question Text</font></th>
        <th><font color="#4D88DB">Answer1</font></th>
        <th><font color="#4D88DB">Answer2</font></th>
        <th><font color="#4D88DB">Answer3</font></th>
        <th><font color="#4D88DB">Answer4</font></th></tr>
        
        <% int id=1; %>


<c:if test="${ not empty Questionpaper}">
<c:forEach var="Questionpaper" items="${Questionpaper}">
   
    <input type="hidden" name="qno" value="${Questionpaper.qno }"><tr></tr><tr></tr><tr></tr>
    
   <tr><td align="center"><font color="">${Questionpaper.qno }</font></td>
   
    <td><font color=""><font color="">${Questionpaper.qtext }</font></td>
    
      
        <td><input type="radio"  id="ans" name="<%=id%>" value="${Questionpaper.ans1 }" ><font color="">${Questionpaper.ans1 }</font> </td>
        <td><input type="radio"  id="ans" name="<%=id%>" value="${Questionpaper.ans2 }"><font color="">${Questionpaper.ans2 }</font></td>
        <td><input type="radio"  id="ans" name="<%=id%>" value="${Questionpaper.ans3 }"><font color="">${Questionpaper.ans3 }</font></td>
        <td><input type="radio"  id="ans" name="<%=id%>" value="${Questionpaper.ans4 }"><font color="">${Questionpaper.ans4 }</font></td></tr>
        
         <%
        
       
        id++;
        %>
       
      </c:forEach>
      </c:if> 
       
       
		<input type=hidden id=<%=id %> name="Time" value="<%=id-1%>">
		
		
  </table><center><input type=button value=Cancel onClick="opWin()">
<input type="submit" value="submit"/></center></form>
<table><tr><td><font color=""><b>Time :</b></font></td><td><font color=""><b><%=id-1 %> Minutes</b></font></td></tr>
       
      
     <jsp:include page="Footer.jsp"></jsp:include>
        </body>